home *** CD-ROM | disk | FTP | other *** search
- Path: Inter.NL.net!usenet
- From: Auke.Reitsma@net.HCC.nl (Auke Reitsma)
- Newsgroups: comp.lang.c
- Subject: Re: Initialising structure members - help please!
- Date: Tue, 20 Feb 1996 20:23:51 GMT
- Organization: Inter.NL.net, The Internet Provider in The Netherlands.
- Message-ID: <4gdasm$bhv@altrade.nijmegen.inter.nl.net>
- References: <4gb8hn$3m8@news.mistral.co.uk>
- Reply-To: Auke.Reitsma@net.HCC.nl
- NNTP-Posting-Host: rt99-20.rotterdam.nl.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- mikebarnard@mistral.co.uk (Mike Barnard) wrote:
-
- ...
- > struct menuitem
- > {
- > int number; // Item 1, item 2 etc.
- > char description[70]; // Room for a text description
- > struct menuitem *next; // Pointer to next menu item
- > struct menuitem *last; // Pointer to last menu item
- > };
-
- Answer this: "What is the type of the element named 'next"?
-
- > Now I create 5 instances of variables of the type menuitem...
- ...
- > struct menuitem one,two,three,four,five;
-
- again: "What is the type of each of these"?
-
- > Now, the fun (not) bit. I tried to initialise the items with...
-
- > one.number = 1;
- > one.description = "1. Calculate a minefield";
- > one.next = two;
-
- So what type are you assigning to the other?
-
- > one.last = five;
- ...
- > This is an almost exact copy of the structure examples in my book.
- > (The beginners guide to C by Wrox). Page 387 for those who have it.
-
- Probably ;-) Hint: you may be missing a single character ...
-
- > So, can anyone help please? (I must get snippets!).
-
- Yes, you should get Snippets ;-)
-
-
- Greetings from Delft, The Netherlands.
-
- Auke Reitsma
-
-